home *** CD-ROM | disk | FTP | other *** search
/ Chip 2001 May / Chip Mayıs 2001.iso / prog / share / 14 / setup.exe / %MAINDIR% / Scripts / VB script default.vbs < prev    next >
Encoding:
Text File  |  2001-03-30  |  4.1 KB  |  127 lines

  1. '********************************************************************
  2. '*                  -=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  3. '*                   CuteFTP Pro Script Template
  4. '*                  -=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  5. '*
  6. '*This default template script is in Visual Basic. You can write 
  7. '*scripts in your language of choice and save it with the proper
  8. '*extenstion, or use your an editor specific to that language
  9. '*
  10. '*
  11. '*See the help file for more details on how this scripting feature
  12. '*works. Below is a quick reference of supported commands, followed
  13. '*by a sample script. You must have Windows Scripting Host installed 
  14. '*for the COM enabled engine to work
  15. '*
  16. '*----TEConnection object command reference---
  17. '*
  18. '*Public members (Data type followed by the command)
  19. '*See the help file for a more detailed list
  20. '*
  21. '*BSTR Host 
  22. '*BSTR Protocol 
  23. '*Long Port
  24. '*BSTR Login
  25. '*BSTR Password
  26. '*BSTR UseProxy 
  27. '*BSTR TransferType 
  28. '*BSTR LocalFolder
  29. '*BSTR RemoteFolder
  30. '*BSTR LocalFilterExclude, LocalFilterInclude
  31. '*BSTR RemoteFilterExlude, RemoteFilterInclude
  32. '*Long Retries
  33. '*Long Delay
  34. '*BSTR Autorename 
  35. '*BSTR Links 
  36. '*
  37. '*Public functions - Return Type | Function Name ([argument 1],[arguement2])
  38. '*void Connect ()
  39. '*void Download (BSTR RemoteName, BSTR LocalName)
  40. '*void Upload (BSTR LocalName, BSTR RemoteName)
  41. '*void CreateLocalFolder (BSTR strName)
  42. '*void CreateRemoteFolder (BSTR strName)
  43. '*void LocalRemove (BSTR strName)
  44. '*void RemoteRemove (BSTR strName)
  45. '*void RemoteRename (BSTR strFrom, BSTR strTo)
  46. '*void LocalRename (BSTR strFrom, BSTR strTo)
  47. '*short LocalExist (BSTR strName)
  48. '*short RemoteExist (BSTR strName)
  49. '*****************************************************************
  50.  
  51. 'Sample Script in Visual Basic
  52. 'Sample script using the TEConnection object 
  53. 'Look into c:\temp folder to observe local activity (for testing purposes)
  54. 'or Right Click on the Transfer Engine icon in the systray and select "show current transfers"
  55. 'Uses an anonymous login to ftp://kyle.globalscape.net
  56.  
  57.     'First specify a variable called Mysite
  58.     
  59. Dim MySite
  60.  
  61.     'Creating a connection object and assign it to the variable
  62.     
  63. Set MySite = CreateObject("CuteFTPPro.TEConnection")
  64.     
  65.     'Now set each property for the site connection or use the defaults
  66.    
  67. MySite.Protocol = "FTP"
  68. MySite.Host = "kyle.globalscape.com"
  69. MySite.Login = "anonymous"
  70. MySite.Password = "user@user.com"
  71. MySite.RemoteFolder = "/Pub/cuteftp"
  72.    
  73.  
  74.     'Now see if the local folder exists 
  75.     
  76. If (Not (MySite.LocalExists("c:\temp"))) Then
  77.     
  78.     'Create it if necessary
  79.     'MySite.CreateLocalFolder "c:\temp"
  80.     'end of the if/then/else clause
  81.     
  82. End If
  83.     
  84.     'Change directories to the destination folder
  85.     
  86. MySite.LocalFolder = "c:\temp"
  87.     
  88.  
  89.     'Check if the remote folder exists using another method 
  90.     
  91.  b = MySite.RemoteExists("english")
  92.     
  93.     'assign the above in to a variable then qualify it
  94.     
  95. If (Not b) Then
  96.     
  97.     'tell the user that the folder was not found and quit since i have no
  98.     ' permission to create the remote folder anyway
  99.      
  100. MsgBox "Remote folder not found!. Please make sure that the english folder exists on the remote site"
  101. Quit(1)
  102. End If
  103.     
  104.     'Downloading the english folder with all its files into the 
  105.     'local destination folder, giving it a new long name
  106.     
  107. MySite.Download "english", "latest english cuteftp version"
  108.     
  109. MsgBox "Folder english was successfully downloaded to c:\temp\latest english cuteftp version"
  110.     
  111.     'now we are going to rename the local folder to something shorter
  112.     'but first check to see if a folder with that name already exist.
  113.     
  114. If (MySite.LocalExists("Latest")) Then
  115. MySite.LocalRemove "Latest"
  116. MsgBox "Previous version of Latest deleted"
  117. End If
  118.  
  119.     'Rename the local folder
  120.     
  121. MySite.LocalRename "latest english cuteftp version", "Latest"    
  122. MsgBox "Folder renamed to Latest"
  123.  
  124. 'Done
  125. 'End of sample script. 
  126. 'You can save you script and then run it by either selecting it from the Tools > Run
  127. 'Script menu of by double clicking on the script file in Windows